package com.example.demospirngdatamybatis.servcie;

import com.example.demospirngdatamybatis.entity.Comment;
import com.example.demospirngdatamybatis.mapper.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentServcie {
    @Autowired
    CommentMapper commentMapper;

    public int addComment(Comment comment){
        return commentMapper.addComment(comment);
    }

    public int deleteCommentById(int id){
        return commentMapper.deleteCommentById(id);
    }

    public int updateCommentById(Comment comment){
        return commentMapper.updateCommentById(comment);
    }

    public List<Comment> getAllComments(){
        return commentMapper.getAllComments();
    }

    public Comment getCommenttById(int id){
        return commentMapper.getCommentById(id);
    }

}
